package j08string;

public class J4 {
    public static void main(String[] args) {
        String s1 = "a_a_a_a_m";
        System.out.println(s1.indexOf("a"));//0
        System.out.println(s1.indexOf("_a"));//1
        System.out.println(s1.indexOf("b"));//-1
        System.out.println(s1.indexOf("am"));//-1
        System.out.println(s1.indexOf(97));//0

        System.out.println("=====");
        System.out.println("aab".indexOf("a",2));//-1
        System.out.println("aab".indexOf("a",1));//1

        System.out.println("ababab".lastIndexOf("a"));//4
        System.out.println("ababab".lastIndexOf("a",3));//2
    }
}
